SDN is a new network architecture and is widely applied to a data center network and a telecommunications network. As shown in FIG. 1, the SDN decouples a control logic of a network element from a forwarding function of the network element. A control layer provides a network service. The network service is implemented by delivering a corresponding policy by the control layer to a network device. The network device is configured to transmit a packet at a forwarding layer. The network service includes various network services and applications, such as routing, multicast, quality of service, and access control.
An OpenFlow protocol is a typical technology in an SDN network. According to the OpenFlow protocol, a OpenFlow controller (OF Controller for short hereinafter) implements a function of a control layer, and several OpenFlow switches (OF Switch for short hereinafter) are used as forwarding-layer network devices to implement a function of the forwarding layer. Each switch may be connected to several hosts.
The OF controller is responsible for determining an action of a service flow according to a packet characteristic. The packet characteristic includes an Internet Protocol (IP) quintuple, an Ethernet frame header, a virtual local area network identification (VLAN ID), and the like. In addition, the OF controller delivers a flow table rule to the OF switches. The OF switches obtain and store the flow table rule, and perform a corresponding action on a subsequent packet that meets the flow table rule, so as to forward or process the packet.
As shown in FIG. 2, a basic process of delivering a flow table rule is as follows.
Step 201: An OF controller sends a flow table rule to an OF switch by using an OFP_Flow_Mod message (that is, a flow table modification message).
The OF controller may deliver flow table rules of different flow tables to the OF switch by using multiple OFP_Flow_Mod messages.
Step 202: The OF switch stores all flow table rules and corresponding forwarding action sets into corresponding flow tables.
Step 203: When receiving a packet sent by a user, the OF switch performs flow table matching for the received packet, and performs corresponding forwarding processing on the received packet according to a matched flow table rule and a corresponding forwarding action set thereof.
As shown in FIG. 3, a process of flow table matching and forwarding processing is as follows.
When a packet is input to a switch by using an ingress port, matching starts from the first flow table, Table 0. If a corresponding flow table rule is matched, an instruction in the flow table rule is executed, and matching proceeds to a next flow table, Table 1, according to the instruction. When matching is performed on Table 1 for the packet, the packet carries ingress port information and metadata information. Metadata is a value of a maskable register and is used to transfer information between flow tables. If an instruction in a matched flow table rule in Table 1 does not instruct to go to a next flow table, matching ends, and a corresponding action set corresponding to the matched flow table rule in Table 1 is executed. If no corresponding flow table rule is matched in a flow table for the packet, the packet is discarded or forwarded to the OF controller for processing. For example, the OF controller forwards the packet to a designated output port, discards the packet, modifies a packet header, or forwards the packet according to a group table.
In an Ethernet Protocol, if a source host needs to communicate with a destination host, the source host has to know a MAC address of the destination host. However, the source host usually knows only an IP address of the destination host. A basic function of the ARP is to query for and obtain the MAC address of the destination host by using the IP address of the destination host. As shown in FIG. 4, a process of implementing, based on the ARP, communication between hosts is as follows.
Step 401: Before sending a packet to a host B, a host A checks whether a locally cached ARP mapping table has an ARP entry of the host B. If the locally cached ARP mapping table has the ARP entry of the host B, the host A directly sends the packet to the host B according to the ARP entry; or if the locally cached ARP mapping table does not have the ARP entry of the host B, step 402 is executed.
Step 402: The host A sends an ARP request message to an entire network by using a connected switch S1.
In actual application, the host A sends the ARP request message to the connected switch S1, and the switch S1 broadcasts the ARP request message to the entire network.
Step 403: After receiving the ARP request, the host B adds an ARP entry of the host A to the host B.
Step 404: The host B sends an ARP response to the host A in a unicast manner by using a connected switch S2.
Specifically, the switch S2 obtains MAC address information of the host A by using the received ARP request message, and may send the ARP response to the host A in a unicast manner according to the MAC address information of the host A.
Step 405: After receiving the ARP response, the host A adds the ARP entry of the host B.
In a subsequent communication process with the host B, a packet can be sent to the host B according to the ARP entry.
It can be learned that, broadcast of the ARP request message consumes plenty of network bandwidth. In a network architecture using the SDN, to reduce a quantity of times for broadcasting an ARP request message, an OF controller is configured to store ARP mapping tables of an entire network and process all ARP requests.
As shown in FIG. 5, an existing ARP implementation method is as follows.
501: A host A sends an ARP request message to a connected switch OF switch S1.
502: The OF switch S1 encapsulates the ARP request message into a packet-in message and sends the packet-in message to a controller OF controller.
503: The OF controller receives the packet-in message, and searches an internal ARP mapping table for an ARP entry of a host B. If the ARP entry of the host B is found, the OF controller directly generates an ARP response, encapsulates the ARP response into a packet-out message, and returns the packet-out message to the OF switch S1; or if no ARP entry of the host B is found, the OF controller stores an ARP entry of the host A, and instructs, in a manner of a packet-out message, all OF switches to send the ARP request to connected hosts.
504: A switch OF switch S3 forwards the ARP request to the host B.
505: The host B returns an ARP response.
506: The OF switch S3 encapsulates the ARP response into a packet-in message and sends the packet-in message to the OF controller.
507: The OF controller receives the packet-in message, stores the ARP entry of the host B, encapsulates the ARP response into a packet-out message, and sends the packet-out message to the OF switch S1.
508: The OF switch S1 then forwards the ARP response to the host A.
After receiving the ARP response, the host A adds the ARP entry of the host B. In a subsequent communication process, the host A can send a packet to the host B according to the ARP entry.
According to an existing SDN-based ARP implementation method, maintaining all ARP mapping tables together by using an OF controller reduces a quantity of times for broadcasting an ARP request message. However, with expansion of a network scale and an increase in ARP requests, transmitting a packet-out message to many switches by using a centralized controller (that is, the OF controller) not only results in great control processing load on the controller, but also occupies more transmission resources of the controller. As a result, the controller becomes a processing bottleneck.